package com.chatplus.application.common.enumeration;

/**
 * 前端发起请求使用的客户端类型
 * @author weird
 */
public enum ClientTypeEnum {
    UNKNOWN(""),

    ANDROID("Android_SJ"),

    IOS("ios_sj"),

    PC("pc_sj"),

    WX_MINI_PROGRAM("wx_miniprogram_sj"),

    BD_MINI_PROGRAM("bd_miniprogram_sj"),

    ALIPAY_MINI_PROGRAM("alipay_miniprogram_sj"),

    H5("h5_sj");

    private final String clientId;

    ClientTypeEnum(String clientId) {this.clientId = clientId;}

    public String getClientId() {
        return clientId;
    }

    public static ClientTypeEnum formClientId(String clientId) {
        if (clientId == null) {
            return ClientTypeEnum.UNKNOWN;
        }
        for (ClientTypeEnum value : ClientTypeEnum.values()) {
            if (value.getClientId().equalsIgnoreCase(clientId)) {
                return value;
            }
        }
        return ClientTypeEnum.UNKNOWN;
    }
}
